package com.session04;

import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        //输入7位同学的成绩，找出最高分，最低分(冒泡排序)
        Scanner num = new Scanner(System.in);
        int[] scores = new int[7];
        for (int i = 0; i < scores.length; i++) {
            scores[i] = num.nextInt();
        }
        scores = BubbleSort(scores);
        System.out.println("最高分：" + scores[scores.length - 1]);
        System.out.println("最低分：" + scores[0]);
    }

    public static int[] BubbleSort(int[] scores) {
        for (int i = 0; i < scores.length - 1; i++) {
            for (int j = 0; j < scores.length - 1 - i; j++) {
                if (scores[j] > scores[j + 1]) {
                    int temp = scores[j];
                    scores[j] = scores[j + 1];
                    scores[j + 1] = temp;
                }
            }
        }
        return scores;
    }
}
